<template>
  <el-dialog title="禁用账号"  class="disSubBuyer" :visible.sync="isShowModel" @close="$emit('update:isShowDetail', false)">
    <div class="jxf-flex-center">
      <p>确定需要禁用此账号？</p>
      <p class="c-red">禁用后，当前账号不可登陆，请谨慎操作！</p>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="closeModel">取 消</el-button>
      <el-button type="primary" @click="submitForm">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
  export default {
    name: "DisSubBuyer",
    props: {
      isShowDetail: {
        type: Boolean,
        default: false
      },
      dataInfo: {
        type: Object,
        default: () => {}
      }
    },
    data() {
      return {
        isShowModel: this.isShowDetail,
      }
    },
    methods: {
      closeModel() {
        this.isShowModel = false;
      },
      submitForm() {
        console.log(this.dataInfo)
        let data = {
          id: this.dataInfo.id,
          status: 0
        }
        ajax.post(apis.user.getMerchantStaff, data).then(res => {
          if(res.code === "10000000") {
            this.$message({
              type: 'success',
              message: '禁用成功!'
            });
            this.$emit('fresh')
            this.closeModel()
          } else {
            this.$message.error(res.message)
          }
        })
      }
    },
    computed: {

    },
    watch: {
      isShowDetail(val) {
        this.isShowModel = val;
      }
    }
  }
</script>

<style lang="scss">
  .disSubBuyer {
    .el-dialog {
      width: 500px;
    }
  }
</style>
